from TurtleWorld import *
from math import *
 
world=TurtleWorld()
chris=Turtle()
chris.color = "blue"  
chris.r = 5
chris.delay = 0.0009 
#----------------------------TRIANGLES----------------------------#


def eq_tri(t, size=100, rotate=0):
    print "equilateral triangle: with size:", size, "and rotation:", rotate
    t.lt(rotate)
    count = 1
    while count <=3:
        t.fd(size)
        t.lt(120)
        count +=1
    t.rt(rotate)
#--------------------------QUADRILATERALS-------------------------#

def para(t, width=100, height=75, angle=120, rotate=0):
    print "Parallelogram, with Width:", width, "Height:", height, "Angle:", angle, "and Rotation:", rotate
    t.lt(rotate)
    count = 1
    while count<= 2:
        t.fd(width)
        t.lt(angle)
        t.fd(height)
        t.lt(180-angle)
        count += 1
    t.rt(rotate)

def rhom(t, size=100, angle=120, rotate=120):
    print "Rhombus, with Size:", size, "Angle:", angle, "and Rotation:", rotate
    t.rt(rotate)
    count = 2
    while count<= 3:
        t.rt(angle)
        t.fd(size)
        t.rt(180-angle)
        t.fd(size)
        count += 1
    t.lt(rotate)
        
      
def square(t, size=100, rotate=0):
    print "square, with size:", size, "and rotation:", rotate
    t.lt(rotate)
    count = 1
    while count<= 4:
        t.fd(size)
        t.lt()
        count += 1

def rect(t, width=75,height=100 , rotate=0):
    print "rectangle, with width:", width, "height:", height, "and rotation:", rotate
    t.lt(rotate)
    count = 1
    while count<= 2:
        t.fd(width)
        t.lt()
        t.fd(height)
        t.lt()
        count += 1
    t.lt(rotate)
#------------------------------MOVEMENT---------------------------#

def line(t, x=100, y=100):
    print "Line to a point X:", x, "over and Y:", y, "up"
    dist = sqrt(x**2+ y**2)
    angle = degrees(atan(y/float(x)))
    t.lt(angle)
    t.fd(dist)
    t.rt(angle)
  
def move(t, x, y):
    print "Move without marking to a point X:", x, "over and Y:", y, "up"
    t.pu()
    dist = sqrt(x**2+ y**2)
    angle = degrees(atan(y/float(x)))
    t.lt(angle)
    t.fd(dist)
    t.rt(angle)
    t.pd()
#------------------------------OTHER SHAPES------------------------#

def poly (t,size=100,side=5 ,rotate=0):
    print "polygon with", side, "sides a size of:", size, "and rotation of:", rotate
    t.lt(rotate)
    count = 1
    while count<= side:
        t.fd(size)
        t.rt(360/float(side))
        count += 1
    t.rt(rotate)

"""
Build any other shape functions you want.
Some Ideas:
    Right Triangles (sss, sas, etc)
    Arbitrary Triangles
    Circle
    Arcs
    Go Wild!
    
Bonus for working or challenging functions...no penalty for trying something
"""

#------------------------------TEST-------------------------------#

line(chris)


wait_for_user()